System and method for flow management in software-defined networks

ABSTRACT

One embodiment of the present invention provides a system for facilitating flow definition management in a switch. During operation, the system identifies a generic flow definition which specifies a flow that is not specific to any input port of a switch. The system further stores in a flow lookup data structure one or more port-specific flow rules based on the generic flow definition, wherein each port-specific flow rule corresponds to a respective port capable of processing data flows.

RELATED APPLICATIONS

This application is a continuation of U.S. application Ser. No. 13/669,313, Attorney Docket Number BRCD-3121.1.US.NP, titled “System and Method for Flow Management in Software-Defined Networks,” by inventors Kashyap Tavarekere Ananthapadmanabha, Vivek Agarwal, and Eswara S. P. Chinthalapati, filed 5 Nov. 2012, which claims the benefit of U.S. Provisional Application No. 61/558,332, Attorney Docket Number BRCD-3121.0.1.US.PSP, titled “Per Port Chain for OpenFlow Generic Mode Flows Database,” by inventors Kashyap Tavarekere Ananthapadmanabha, Vivek Agarwal, and Eswara S. P. Chinthalapati, filed 10 Nov. 2011, the disclosure of which is incorporated by reference herein.

BACKGROUND

Field

The present disclosure relates to network management. More specifically, the present disclosure relates to a method and system for efficient management of flow definitions in a software-defined network.

Related Art

The exponential growth of the Internet has made it a popular delivery medium for heterogeneous data flows. Such heterogeneity has caused an increasing demand for bandwidth. As a result, equipment vendors race to build larger and faster switches with versatile capabilities, such as defining data flows using software, to move more traffic efficiently. However, the complexity of a switch cannot grow infinitely. It is limited by physical space, power consumption, and design complexity, to name a few factors. Furthermore, switches with higher and versatile capability are usually more complex and expensive.

Software-defined flow is a new paradigm in data communication networks. Any network supporting software-defined flows can be referred to as software-defined network. An example of a software-defined network can be an OpenFlow network, wherein a network administrator can configure how a switch behave based on data flows that can be defined across different layers of network protocols. A software-defined network separates the intelligence needed for controlling individual network devices (e.g., routers and switches) and offloads the control mechanism to a remote controller device (often a stand-alone server or end device). Therefore, a software-defined network provides complete control and flexibility in managing data flow in the network.

While support for software-defined flows brings many desirable features to networks, some issues remain unsolved in management of flow definitions. For example, because software-defined networks redefine traditional data flow management, coexistence of software-defined network with current network architecture can be challenging.

SUMMARY

One embodiment of the present invention provides a system for facilitating flow definition management in a switch. During operation, the system identifies a generic flow definition which specifies a flow that is not specific to any input port of a switch. The system further stores in a flow lookup data structure one or more port-specific flow rules based on the generic flow definition, wherein each port-specific flow rule corresponds to a respective port capable of processing data flows.

In a variation on this embodiment, the system includes a content addressable memory (CAM), wherein the flow lookup data structure is stored in the CAM.

In a variation on this embodiment, the system includes a flow table configurable to store the generic flow definition with a flag indicating that the generic flow definition is not specific to any input port.

In a variation on this embodiment, the switch is an OpenFlow-capable switch.

In a variation on this embodiment, the system maintains a per-port linked list for a respective port capable of processing data flows. A node in the linked list indicates a flow identifier for a flow definition applicable to the port. Further, the nodes in the linked list are sorted in the order of priority of the corresponding flow definitions.

In a further variation, the system stores in a flow table one or more flow definitions with corresponding flow identifier(s).

In a further variation, a respective entry in the flow table stores a flow definition. In addition, the system computes a hash value based on the flow identifier for the flow definition, and uses the hash value as an index to the entry.

In a further variation, the system updates a flow definition. In doing so, the system traverses a per-port linked list for a port associated with the flow definition to be updated to locate a flow identifier for the flow definition to be updated. In addition, the system determines one or more flow identifiers whose priority is lower than the located flow identifier. The system then rewrites the flow rules associated with the determined flow identifiers in the flow lookup data structure, thereby preserving the priority order of the flow rules for the port after the update.

BRIEF DESCRIPTION OF THE FIGURES

FIG. 1A illustrates an exemplary software-defined network, in accordance with an embodiment of the present invention.

FIG. 1B illustrates an exemplary switch in a software-defined network, in accordance with an embodiment of the present invention.

FIG. 2 illustrates an exemplary flow table with per-port expansion of generic flow definition of a software-defined network, in accordance with an embodiment of the present invention.

FIG. 3 illustrates how the flow rules in FIG. 2 can be stored in a CAM, in accordance with an embodiment of the present invention.

FIG. 4A illustrates an exemplary port chain for flow definitions of a software-defined network, in accordance with an embodiment of the present invention.

FIG. 4B illustrates a generic flow definition in relation to per-port chains, in accordance with an embodiment of the present invention.

FIG. 5A presents a flowchart illustrating the process of initiating per-port chain and a corresponding flow table, in accordance with an embodiment of the present invention.

FIG. 5B presents a flowchart illustrating the process inserting a new flow definition using a flow ID, in accordance with an embodiment of the present invention.

FIG. 6 presents a flowchart illustrating the process of a switch in a software-defined network updating a flow definition using a flow identifier, in accordance with an embodiment of the present invention.

FIG. 7 illustrates an exemplary switch in a software-defined network, in accordance with an embodiment of the present invention.

In the figures, like reference numerals refer to the same figure elements.

DETAILED DESCRIPTION

The following description is presented to enable any person skilled in the art to make and use the invention, and is provided in the context of a particular application and its requirements. Various modifications to the disclosed embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other embodiments and applications without departing from the spirit and scope of the present invention. Thus, the present invention is not limited to the embodiments shown, but is to be accorded the widest scope consistent with the claims.

Overview

In embodiments of the present invention, the problem of facilitating coexistence of conventional ports and ports that support software-defined flows in a switch and improving the efficiency of updating flow definitions in a software-defined network is solved by (1) converting a non-port-specific (generic) flow rule to one or more port-specific flow rules; and (2) providing per-port linked-lists of pointers to flow rules, thereby allowing updating flow definitions on a per-port basis.

In general, it is desirable to partition the ports of a switch in a software-defined network into two logical groups. One logical group supports traditional packet forwarding and the other group supports forwarding based on software-defined flows. Ideally, the switch should preclude software-based flow definitions (such as those defined using OpenFlow) to the ports reserved for traditional packet forwarding. However, with the existing technologies, a flow definition that does not specify an input port is usually applied to all the ports of a switch, regardless of whether it is configured for traditional packet forwarding or for software-defined flow forwarding. Hence, erroneous forwarding decision might occur with such non-port-specific (also referred to as “generic”) flow definitions.

A second problem faced by the existing software-defined network architecture is that the flow definitions for the entire switch are maintained in a single linked list, typically in the order of priority. When the network administrator needs to update a rule definition (i.e., add, delete, or change), the switch needs to traverse the entire linked list to identify the location for the update. Also, since the flow definitions are typically stored in a content addressable memory (CAM), the physical storage location for each flow definition corresponds to the definition's priority. Hence, if a flow definition's priority changes (or if it is being added or deleted), all the flow definitions with lower priorities need to be re-written in the CAM, so that their new storage locations reflect the change in the priority order. This update mechanism is inefficient, especially as the number of flow definitions grows big.

The solutions described herein to the above problems are two-fold. First, for a generic, non-port-specific flow definition, the system converts this generic flow definition into one or more port-specific rules for all the ports configured to perform software-defined flow forwarding. As a result, ports reserved for conventional packet forwarding are no longer subject to the software-based flow definitions. Second, for each port configured to perform software-defined flow forwarding, a per-port, priority-ordered linked list stores pointers to flow definitions only associated with that port. Hence, when a flow definition is added, deleted, or modified, the system only needs to traverse the per-port linked list to locate the flow definitions that need to be changed in the CAM. As a result, the amount of overhead associated with flow definition updates can be significantly reduced.

In this disclosure, the term “software-defined network” refers to a network that facilitates control over a respective data flow by specifying the action associated with the flow in a flow definition. A controller, which can be a server, coupled to the software-defined network provides a respective switch in the software-defined network with the flow definitions. A flow definition can include a priority value, a rule that specifies a flow, and an action (e.g., a forwarding port or “drop”) for the flow. The rule of a flow definition can specify, for example, any value combination in the ten-tuple of {in-port, VLAN ID, MAC SA, MAC DA, Ethertype, IP SA, IP DA, IP Protocol, TCP source port, TCP destination port}. Other packet header fields can also be included in the flow rule. Depending on its specificity, a flow rule can correspond to one or more flows in the network. Upon matching a respective packet to a rule, the switch in the software-defined network takes the action included in the corresponding flow definition. An example of a software-defined network includes, but is not limited to, OpenFlow, as described in Open Networking Foundation (ONF) specification “OpenFlow Switch Specification,” available at http://www.openflow.org/documents/openflow-spec-v1.1.0.pdf, which is incorporated by reference herein.

In this disclosure, a switch in a software-defined network and capable of processing software-defined flows is referred to as a “software-definable” switch. Such a software-definable switch can include both ports that process software-defined flows and ports reserved for convention packet forwarding (e.g., layer-2/Ethernet switching, or IP routing), which are referred to as “regular ports” in this disclosure. A flow definition typically includes one or more software-definable in-ports to which the definition is applicable. Any flow arriving via any port can potentially be a match for the generic flow definition.

In some embodiments, the software-defined network is a fabric switch and a respective switch in the software-defined network is a member switch of the fabric switch. The fabric switch can be an Ethernet fabric switch. In an Ethernet fabric switch, any number of switches coupled in an arbitrary topology may logically operate as a single switch. Any new switch may join or leave the fabric switch in “plug-and-play” mode without any manual configuration. A fabric switch appears as a single logical switch to the end device.

Although the present disclosure is presented using examples based on OpenFlow, embodiments of the present invention are not limited to networks defined OpenFlow or a particular Open System Interconnection Reference Model (OSI reference model) layer. In this disclosure, the term “software-defined network” is used in a generic sense, and can refer to any network which facilitates switching of data flows based on software-defined rules. The term “flow definition” is also used in a generic sense, and can refer to any rule which identifies a frame belonging to a specific flow and/or dictates how a switch should process the frame.

The term “end device” can refer a host, a conventional layer-2 switch, or any other type of network device. Additionally, an end device can be coupled to other switches or hosts further away from a network. An end device can also be an aggregation point for a number of network devices to enter the network.

The term “frame” refers to a group of bits that can be transported together across a network. “Frame” should not be interpreted as limiting embodiments of the present invention to layer-2 networks. “Frame” can be replaced by other terminologies referring to a group of bits, such as “packet,” “cell,” or “datagram.”

The term “switch” is used in a generic sense, and it can refer to any standalone or fabric switch operating in any network layer. “Switch” should not be interpreted as limiting embodiments of the present invention to layer-2 networks. Any device that can forward traffic to an end device can be referred to as a “switch.” Examples of a “switch” include, but are not limited to, a layer-2 switch, a layer-3 router, a TRILL RBridge, an FC router, or an FC switch.

The term “Ethernet fabric switch” refers to a number of interconnected physical switches which form a single, scalable logical switch. In a fabric switch, any number of switches can be connected in an arbitrary topology, and the entire group of switches functions together as one single, logical switch. This feature makes it possible to use many smaller, inexpensive switches to construct a large fabric switch, which can be viewed as a single logical switch externally.

Network and Switch Architecture

As mentioned above, in a switch in a software-defined network, a generic flow definition could be applied to a software-definable port or a regular port. As a result, the isolation between software-definable ports and regular ports is compromised, and the switch can undesirably forward regular traffic based on a generic flow definition. Typically, upon receiving a flow definition from a controller, a conventional switch in software-defined network uses a single data structure (such as a master linked-list) to store all flow definitions for all ports. In hardware (e.g., CAM), the corresponding flow rules are typically stored based on the respective priorities of the flow definitions. When the controller sends instruction to the switch to add a new flow definition or update (i.e., delete or modify) an existing flow definition, the switch adds, deletes, or modifies the corresponding flow definition in the master linked-list. However, to delete or modify, the switch searches the entire master linked-list to find the flow definition. Moreover, because the flow rules are also stored in the CAM based on the respective priorities (since the system uses the flow rules stored in the CAM for real-time packet processing), to add or delete a new flow definition, the switch searches the entire list to find the appropriate position for the flow definition and has to shift all the entries in the CAM with priorities lower than the added or deleted flow definition. Furthermore, if the priority of an existing flow definition changes, the same location shift has to be done for all affected entries in the CAM. As a result, the switch incurs significant overhead of rewriting when one needs to modify a flow definition, although the modified flow definition might be related to only a subset of all the software-definable ports.

To solve this problem, a switch in a software-defined network associates a generic flow definition with all the software-definable ports in the switch and storing multiple port-specific flow rules (corresponding to each software-definable port) in the CAM. Upon receiving a generic flow definition from the controller, the switch identifies the software-definable ports in the switch and creates a flow rule for a respective software-definable port by inserting the corresponding port index in the “in-port” field of the flow rule. In this way, the switch expands the generic flow definition to multiple port-specific flow rules corresponding to the software-definable ports. This expansion ensures isolation of regular ports from software-definable ports. Consequently, the switch applies a flow definition only to software-defined ports.

The switch also creates a per-port linked list (also referred to as “per-port chain”), which is a list of pointers or identifiers corresponding to flow definitions for a respective software-definable port (i.e., the flow definitions which have the port as in-port). In some embodiments, the switch creates a flow identifier (or a flow ID) for each flow definition. The switch stores the flow definition and its corresponding flow identifier in a table (referred to as “flow table” in this disclosure). The switch stores the flow identifiers of the flow definitions for a given port in the corresponding per-port chain. In other words, each link in a per-port chain is a flow ID. In addition, a respective per-port chain is ordered based on each link's priority (i.e., the corresponding flow definition's priority). Hence, when a flow definition needs to be updated, the switch can traverse the per-port chain for the associated port, identify the flow IDs along the chain whose priority is lower than the flow definition being updated, and only rewrite the flow rules in the CAM corresponding to those affected flow IDs. As a result, the switch can avoid unnecessarily rewriting entries in the CAM that are not related to the affected port, and hence avoid unnecessary down time for those unaffected ports. Furthermore, because the flow definition is stored in the flow table, and each port only maintains a per-port chain which includes only flow IDs, if a flow definition is associated with a plurality of in-ports (e.g., a generic flow definition), the switch can just store the generic definition once with a set “generic-flow flag” in the flow table, and use the same flow ID in multiple per-port chains.

In some embodiments, the flow table is a hash table and the flow ID can be used as hash keys to generate a hash value, which is then used as an index to the flow table to map to a flow definition. In addition, since the per-port chain is ordered based on the flow definitions' priority, the position of each link in the chain inherently carries with it the priority information. In addition, for the flow rules corresponding to the links in a per-port chain, the storage locations of these flow rules in the CAM are also ordered in the same priority order. In this way, when the switch performs a CAM lookup for an incoming packet, the lookup result returned by the CAM automatically reflects the matching flow rule with the highest priority. Note that the flow rules stored in the CAM are all port-specific, assuming that a generic flow definition has been converted to multiple port-specific flow rules for the individual ports. Further, depending on the implementation, a larger or smaller numeric priority value may correspond to higher or lower priority. In one embodiment, the switch does not store the expanded generic flow definitions (i.e., multiple port-specific flow definitions, each for a different software-definable port) in the flow table. Instead, the switch stores the generic flow definition only once in the flow table, with a set generic-flow flag (to distinguish the generic flow definition from other port-specific definitions), and inserts the corresponding flow ID into a respective port chain.

FIG. 1A illustrates an exemplary software-defined network, in accordance with an embodiment of the present invention. A heterogeneous software-defined network 100 includes regular switches 101 and 104. Also included are switches 102, 103, 105, and 106, which are capable of processing software-defined flows. Switches 102, 103, 105, and 106 are software-definable switches. Controller 120 is logically coupled to a respective software-definable switch in network 100. Note that controller 120 can be physically coupled to only a subset of the switches. In this example, controller 120 is coupled to switches 103 and 106 via physical links 122 and 124, respectively. End device 112 is coupled to network 100 via software-definable switch 105.

Software-definable switch 102 includes one or more software-definable ports. Switch 102 uses its software-definable ports to couple other software-definable switches 103, 105, and 106. Similarly, software-definable switches 103, 105, and 106 also use their respective software-definable ports to couple other software-definable switches. Switch 102 also includes regular ports coupled to regular switches 101 and 104. During operation, controller 120 sends flow definitions to switches 102, 103, 104, and 105. Switch 102 receives a flow definition and checks whether the flow definition is a generic flow definition. If so, any flow arriving to switch 102 via any port can potentially be a match for the generic flow definition.

To ensure isolation between software-definable ports and regular ports, and avoid forwarding regular traffic based on the generic flow definition, in switch 102 generates multiple port-specific flow rules based on the generic flow definition, one for each software-definable port. In some embodiments, switch 102 creates these new flow rules by adding a respective software-definable port as the in-port to the generic flow definition. Switch 102 then inserts the generic flow definition in a local flow table with a set generic-flow flag, and writes the generated port-specific flow rules to its local CAM. Similarly, upon receiving the generic flow definition, switches 103, 105, and 106 also insert the generic flow definition with the generic-flow flag in their respective local flow tables and stores the generated port-specific flow rules in their respective CAM. Switches 102, 103, 105, and 106, thus, always apply a flow definition to flows coming from software-definable ports, and avoid applying the flow definition to traffic received from regular ports.

In some embodiments, a respective software-definable switch in network 100 creates a per-port chain of flow definitions for a respective software-definable port. For example, software-definable switch 103 creates a per-port chain for the software-definable ports which couple switches 102, 105, and 106. Switch 103 sorts the per-port chain based on the priority of the flow definitions. When switch 103 receives a flow definition from controller 120, switch 103 creates a flow ID for the flow definition and stores the flow definition and its corresponding flow ID in a flow table. In addition, switch 103 stores the flow IDs of the flow definitions for the port in the corresponding per-port chain. The flow table in switch 103 can be a hash table where flow IDs are hash keys for locating the corresponding flow definitions in the flow table. Similarly, software-definable switches 102, 105, and 106 also store the flow definitions in a hash table and the corresponding flow IDs in local per-port chains.

FIG. 1B illustrates an exemplary switch in a software-defined network, in accordance with an embodiment of the present invention. In this example, software-definable switch 105 is coupled to other software-definable switches 102, 103, and 106 via software-definable ports 155, 156, and 157, respectively. Switch 105 also includes regular ports 151, 152, and 153, which are not software-definable and couple regular switches 101 and 104, and end device 112, respectively. During operation, controller 120 sends a flow definition to switch 105. If the flow definition is a generic flow definition, switch 105 expands the generic flow definition by creating a port-specific flow rule for each of ports 155, 156, and 157 based on the generic flow definition. Switch 105 then stores the generic flow definition in flow table 160 with a set generic-flow flag and stores the generated per-port flow rules in a CAM 161. Switch 105, thus, only applies the generic flow definition to flows coming via ports 155, 156, and 157.

Furthermore, switch 105 also creates per-port chains 165, 166, and 167 for ports 155, 156, and 157, respectively. Per-port chains 165, 166, and 167 are sorted based on the priority of the flow definitions associated with the respective port. When switch 105 receives a flow definition (either generic or port-specific) from controller 120, switch 105 creates a flow ID for the flow definition. Switch 105 stores the flow definition and the corresponding flow ID in flow table 160. Switch 105 then inserts the flow ID in the corresponding per-port chain in sorted order. Suppose that the flow definition is for port 155. Switch 105 stores the flow ID in per-port chain 165. If the flow definition is a generic flow definition, switch 105 stores the flow ID in per-port chains 165, 166, and 167. In this way, switch 105 can store a generic flow definition only once.

During operation, switch 105 receives a frame from switch 102 via port 155. Switch 105 extracts the frame's header information and performs a lookup in CAM 161. CAM 161, which stores port-specific flow rules, returns a result that indicates a matching flow definition with the highest priority. Note that, since a generic flow definition is stored as multiple port-specific flow rules in CAM 161, the generic flow definition is automatically included in the CAM lookup. Switch 105 identifies and performs the action specified in the matching flow definition.

Generic Flow Definition Expansion

In the example in FIG. 1B, flow table 160 can include a plurality of entries corresponding to a plurality of flow definitions. FIG. 2 illustrates an exemplary flow table with per-port expansion of generic flow definition of a software-defined network, in accordance with an embodiment of the present invention. In this example, each entry in flow table 160 of switch 105 includes the following fields: an index field 210, a flow ID field 212, a flow rule field 214, a generic flow definition flag field 214, an action field 216, and a priority field 218. Additional fields carrying other flow-related information can also be included in flow table 160.

Index field 210 stores the index to each entry (i.e., a flow definition). In one embodiment, the index to a given entry is the hash value of the flow ID for the corresponding flow definition. Flow ID field 212 stores the flow ID for a given entry. Flow rule field 214 stores the specific header field values which need to be matched to identifying a particular flow. A flow rule can include one or more of: an input port (in-port), a layer-2 source address, a layer-2 destination address, a layer-2 frame type, a VLAN ID, a layer-3 source address, a layer-3 destination address, a layer-4 (e.g., transport layer) protocol, a layer-4 source address, and a layer-4 destination address.

Generic flow definition flag field 214 stores a one-bit flag for each entry to indicate whether the flow definition is a generic definition, which applies to all the software-definable ports. Action field 216 stores the action to be taken for a given flow, such as an output port (“out-port”) or “drop.” In one embodiment, action field 216 may store a pointer to an “action table” (not shown) that contains information describing more complex operations for a flow. Priority field 218 stores the priority value associated with each flow definition.

In this example, flow definitions 251, 252, and 253 are respectively associated with to input ports 155, 157, and 156, as specified by the “in-port” field of their respective flow rules 202, 204, and 206. If a frame's header fields match what is specified in rule 202, 204, or 206, the switch forwards the frame to port 157, 156, or 155, respectively, as specified in the action field of each flow definition.

For each non-generic flow definition, as indicated by a “0” in its generic flow definition flag 214, the corresponding flow rule is stored in the switch's CAM for line-speed lookups. The locations of these rules in the CAM reflect their priority order, on a per port basis.

Flow table 160 can also include a generic flow definition 254, which does not specify a particular in-port in its corresponding flow rule 208 (as indicated by the wildcard character “*”). Generic flow definition 254 specifies in action field 216 an out-port 156. In one embodiment, switch 105 expands flow rule 208 of generic flow definition 254 by creating a new port-specific flow rule for each software-definable port, namely ports 155, 156, and 157. The newly created rules 208-1, 208-2, and 208-3 each specifies port 155, 156, and 157 as their respective in-port. Switch 105 then stores rules 208-1, 208-2, and 208-3 in its CAM based on their priority order for each the in-port. Note that the expanded rules 208-1, 208-2, and 208-3 all inherit the same priority value (“19”) from generic flow definition 254. Assume that a greater priority value indicates a higher priority. Hence, in the CAM, for all the flow rules associated with in-port 155, rule 208-1 (priority 19) is stored before rule 202 (priority 10). However, for all the flow rules associated with in-port 156, rule 208-2 (priority 19) is stored after rule 206 (priority 23). Similarly, for all the flow rules associated with in-port 157, rule 208-3 (priority 19) is stored after rule 204 (priority 37).

FIG. 3 illustrates how the flow rules in FIG. 2 can be stored in a CAM, in accordance with an embodiment of the present invention. In this example, a lower storage position in the CAM corresponds to a higher priority of the flow rule. Note that the entire set of flow rules are not stored in a strict priority order. However, for all the rules associated with a given in-port, the storage locations of these rules preserve their priority order. For example, rule 208-1 is stored below rule 206, although rule 208-1′s priority is lower than rule 206′s priority. Nevertheless, rule 208-1 and rule 206 are associated with different in-ports, hence their relative locations in the CAM do not affect the lookup (since a frame can arrive from one in-port and hence can only match one of these two rules). However, for rules associated with the same in-port, for example, rule 208-1 and rule 202, their relative positions in the CAM preserve their priority order (i.e., rule 208-1 is stored below rule 202, since rule 208-1 has a higher priority). The priority order of the rules for each in-port is maintained by a per-port chain, as described below.

Per-Port Chain

As mentioned earlier, in conventional switches, all the flow rules are stored in the CAM based on a switch-wide priority order. Such configuration results in significant overhead when a flow rule is added, deleted, or changes its priority, because all the rules in the CAM with priority lower than the changed rule need to be rewritten to new locations. Embodiments of the present invention mitigate this problem by using a per-port chain, which is a port-specific linked list of flow IDs sorted in their priority order. These per-port chains keep track of the priority order of all the flow rules for a particular port. When a flow rule for a port needs to be changed, only those rules with lower priority for that port, as indicated by the per-port chain, need to be rewritten in the CAM.

FIG. 4A illustrates an exemplary per-port chain for flow definitions of a software-defined network, in accordance with an embodiment of the present invention. In this example, a flow table 450 in switch 400 includes flow definitions 451, 452, 453, 454, 455, 456, 457, and 458, with flow ID 471, 472, 473, 474, 475, 476, 477, and 478, and priority values 403, 404, 408, 409, 411, 412, 421, and 438, respectively. Note that not all fields of flow table 450 are shown.

Switch 400 creates per-port chains 495, 496, and 497 for local software-definable ports 485, 486, and 487, respectively. Per-port chain 495 includes flow IDs 476, 475, 474, and 473, sorted based on the priority values of the corresponding flow definitions 456, 455, 454, and 453, respectively. Similarly, per-port chain 496 includes flow IDs 477, 474, and 472, sorted based on the priority values of the corresponding flow definitions 457, 454, and 452, respectively. Per-port chain 497 includes flow IDs 478, 474, and 471, sorted based on the priority values of the corresponding flow definitions 458, 454, and 451, respectively.

During operation, switch 400 receives an update to a flow definition (say flow definition 455) which changes its priority. Switch 400 first searches flow table 450 to identify flow definition 455′s flow ID, which is flow ID 475. Switch 400 then identifies that flow definition 455 is associated with port 485. In response, switch 400 traverses per-port chain 495 to identify the position of flow ID 475, as well as the flow IDs affected by the update. After the update, per-port chain 495 would have a new priority order. Switch 400 then rewrites in the CAM all the flow rules corresponding to the affected flow IDs. Note that the CAM rewriting only affects the rules associated with port 485. Hence, during such rule updates, the CAM can remain function for the unaffected ports. The service disruption can therefore be significantly reduced.

FIG. 4B illustrates a generic flow definition in relation to per-port chains, in accordance with an embodiment of the present invention. Assuming flow definition 454 is a generic flow definition, the corresponding flow ID 474 is included in per-port chains 495, 496, and 497. Note that, as described previously in conjunction with FIGS. 2 and 3, flow definition 454 corresponds to multiple port-specific flow rules stored in the CAM. When the switch needs to update flow definition 454, the system first determines that flow definition 454 is a generic definition. The system then traverses the per-port chain for every port to identify the affected flow IDs, and rewrite, as necessary, all the affected flow rules in the CAM.

In the example in FIG. 1B, switch 105 first initiates per-port chains 165, 166, and 167 for the flow definitions in flow table 160. Switch 105 then performs the necessary operations (e.g., adding, deleting, and updating) for a flow definition using both flow table 160 and per-port chains 165, 166, and 167. FIG. 5A presents a flowchart illustrating the process of initiating per-port chain and a corresponding flow table, in accordance with an embodiment of the present invention. During operation, the switch first initiates a seed for a flow ID generator (operation 502). Examples of a flow ID generator include, but are not limited to, a random number generator and a sequential number generator.

The switch then identifies the software-definable ports in the switch (operation 504). In some embodiments, a network administrator allocates a subset of the ports of the switch as the software-definable ports. For example, the network administrator can enable OpenFlow for the subset of the ports to allocate the ports as software definable. The switch then creates a per-port chain for a respective software-definable port (operation 506). A per-port chain can be a linked list or a doubly-linked list. The switch then creates a flow table for storing flow definitions (operation 508). Note that the switch creates a separate entry in the flow table for a respective flow definition. In some embodiments, the flow table is a hash table and a flow ID can be used as a hash key.

FIG. 5B presents a flowchart illustrating the process inserting a new flow definition using a flow ID, in accordance with an embodiment of the present invention. During operation, the switch receives a flow definition from a controller (operation 552). The switch then generates a flow ID (operation 554). This flow ID can be local to the switch. For the same flow definition, a different switch can have a different local flow ID. The switch applies the flow ID as a key to a hash function to generate a hash value (operation 556). The switch then stores the flow definition with the flow ID as an entry in a flow table entry (operation 558). The hash value is the index to this entry.

Next, the switch checks whether the flow definition is a generic flow definition (operation 562). If so, the switch inserts the flow ID into the per-port chains associated with all software-definable ports based on the flow definition's priority (operation 564). In addition, the switch expands this generic flow definition to multiple port-specific flow rules. The switch then stores these new rules in the CAM and rewrites all the affected rules in the CAM (i.e., rules whose position is affected by the new rule) (operation 565). If the flow is not a generic flow definition, the switch identifies the in-port associated with the flow definition (operation 566). The switch then inserts the flow ID into the per-port chain associated with the identified port in the switch based on the flow definition's priority (operation 568). Subsequently, the switch writes the flow rule to the CAM, and rewrites all affected rules for the corresponding port (operation 569).

FIG. 6 presents a flowchart illustrating the process of updating a flow definition, in accordance with an embodiment of the present invention. An update to a flow definition can include a deletion or a modification to the flow definition. During operation, the switch receives an update to an existing flow definition from a controller (operation 602). In response, the switch identifies the port(s) associated with the flow definition (operation 604). If the flow definition is a generic flow definition, the flow definition is associated with all software-definable ports in the switch. The switch further identifies the flow ID associated with the flow definition by, for example, searching the flow table (operation 606). The switch locates the linked-list node(s) comprising the flow ID in the per-port chain(s) associated with the identified port(s) (operation 608).

The switch then checks the update type (operation 612). If the update type is “delete,” the switch removes the located flow table entry, removes the flow rule from the CAM, and rewrites the affected flow rules in the CAM (which are identified after the system traverses the per-port chain in operation 608) (operation 632). The switch then removes the linked-list node(s) from a respective per-port chain (operation 634).

If the operation is “modify,” the switch modifies the identified flow table entry (operation 614) and checks whether the priority of the flow definition is modified (operation 616). If the priority is modified, the switch re-sorts the corresponding per-port chain(s) based on the priority values of the flow definitions (operation 622). The switch then rewrites the affected rules in the CAM (based on the affected flow IDs identified in operation 608) (operation 624).

In some embodiment, a respective per-port chain is a double linked list. The switch can store a pointer to a flow table entry in a corresponding per-port chain. The switch can obtain the flow definition from a flow table using the flow ID (e.g., hashing the flow ID) and directly delete the flow definition in the flow table entry using the pointer stored in a respective per-port chain. Since a respective per-port chain is double linked list, it is easier to maintain the pointer and delete a flow table entry from the per-port chain while maintaining the sanity of the per-port chain.

Exemplary Switch

FIG. 7 illustrates an exemplary switch in a software-defined network, in accordance with an embodiment of the present invention. In this example, a switch 700 includes a number of communication ports 702, a flow definition management module 730, an association module 732, a packet processor 710, and a storage 750. Packet processor 710 further includes a CAM 711. One or more of communication ports 702 are software-definable ports. These software-definable ports can be OpenFlow enabled. Switch 700 receives software-defined data flow via the software-defined flows. During operation, flow definition management module 730 identifies a generic flow definition. This generic flow definition can be a new flow definition received from a controller or already stored in a local flow table. The flow table can reside in storage 750. Association module 732 associates the generic flow definition with a respective software-definable port of switch 700 and creates a new flow definition associated with a respective software-definable port based on the generic flow definition. In some embodiments, association module 732 can store the new flow definitions in the flow table.

In some embodiments, switch 700 includes a flow ID module 720, a hash module 721, a per-port chain management module 740, and a flow table management module 760. During operation, flow ID module 720 generates a flow ID for a flow definition received via one of the communication ports 702. This flow definition can be associated with a software-definable port. Per-port chain management module 740 creates a per-port chain for a respective software-definable port. A node of the per-port chain associated with the software-definable port contains the flow ID. Flow table management module 760 stores the flow definition and the flow ID in an entry in the flow table. Hash module 721 calculates a hash value based on the flow ID and uses the hash value as an index to the entry. Per-port chain management module 740 sorts the per-port chain based on the priority value associated with the flow definition. If the flow definition is modified (e.g., updated or deleted), per-port chain management module 740 precludes flow table management module 760 from sorting the flow definitions which are not associated with the software-definable port.

Upon receiving a frame via the software-definable port, packet processor 710 checks whether the frame received matches with the flow definition. Flow table management module 760 identifies the flow table entry associated with the software-definable port using the flow ID of the flow definition. This flow table can be a hash table and flow table management module 760 can use the flow ID as a hash key to find the flow table entry. If switch 700 is equipped with per-port chain management module 740, when flow definition management module 730 identifies the generic flow definition, per-port chain management module 740 inserts a list node comprising a flow ID of the generic flow into a respective per-port chain in switch 700.

In some embodiments, switch 700 may maintain a membership in a fabric switch. Switch 700 maintains a configuration database in storage 750 that maintains the configuration state of a respective switch within the fabric switch. Switch 700 maintains the state of the fabric switch, which is used to join other switches. Under such a scenario, communication ports 702 can include inter-switch communication channels for communication within a fabric switch. This inter-switch communication channel can be implemented via a regular communication port and based on any open or proprietary format.

Note that the above-mentioned modules can be implemented in hardware as well as in software. In one embodiment, these modules can be embodied in computer-executable instructions stored in a memory which is coupled to one or more processors in switch 700. When executed, these instructions cause the processor(s) to perform the aforementioned functions.

In summary, embodiments of the present invention provide a switch and a method for efficient management of flow definitions in a software-defined network. In one embodiment, the switch includes one or more software-definable ports, a flow definition management module, and an association module. A software-definable port can receive software-defined data flow. During operation, the flow definition management module identifies a generic flow definition of a software-defined network. The generic flow definition is not associated with an incoming port of the switch. The association module associates the generic flow definition with a respective software-definable port of the switch.

The methods and processes described herein can be embodied as code and/or data, which can be stored in a computer-readable non-transitory storage medium. When a computer system reads and executes the code and/or data stored on the computer-readable non-transitory storage medium, the computer system performs the methods and processes embodied as data structures and code and stored within the medium.

The methods and processes described herein can be executed by and/or included in hardware modules or apparatus. These modules or apparatus may include, but are not limited to, an application-specific integrated circuit (ASIC) chip, a field-programmable gate array (FPGA), a dedicated or shared processor that executes a particular software module or a piece of code at a particular time, and/or other programmable-logic devices now known or later developed. When the hardware modules or apparatus are activated, they perform the methods and processes included within them.

The foregoing descriptions of embodiments of the present invention have been presented only for purposes of illustration and description. They are not intended to be exhaustive or to limit this disclosure. Accordingly, many modifications and variations will be apparent to practitioners skilled in the art. The scope of the present invention is defined by the appended claims. 

What is claimed is:
 1. A switch, comprising: a flow definition management module configurable to identify a generic flow definition which specifies a flow that is not specific to any input port of the switch; and a flow lookup data structure configurable to store one or more port-specific flow rules based on the generic flow definition, wherein each port-specific flow rule corresponds to a respective port capable of processing data flows.
 2. The switch of claim 1, further comprising a content addressable memory (CAM), wherein the flow lookup data structure is stored in the CAM.
 3. The switch of claim 1, further comprising a flow table configurable to store the generic flow definition with a flag indicating that the generic flow definition is not specific to any input port.
 4. The switch of claim 1, wherein the switch is an OpenFlow-capable switch.
 5. The switch of claim 1, further comprising a per-port linked list for a respective port capable of processing data flows; wherein a node in the linked list indicates a flow identifier for a flow definition applicable to the port; and wherein the nodes in the linked list are sorted in the order of priority of the corresponding flow definitions.
 6. The switch of claim 5, further comprising a flow table configurable to store one or more flow definitions with corresponding flow identifier(s).
 7. The switch of claim 6, wherein a respective entry in the flow table stores a flow definition; wherein the switch further comprises a hash computation module configurable to compute a hash value based on the flow identifier for the flow definition; and wherein the hash value is used as an index to the entry.
 8. The switch of claim 6, further comprising a flow definition updating module configurable to update a flow definition; and wherein while updating the flow definition, the flow definition updating module is configurable to: traverse a per-port linked list for a port associated with the flow definition to be updated to locate a flow identifier for the flow definition to be updated; determine one or more flow identifiers whose priority is lower than the located flow identifier; and rewrite the flow rules associated with the determined flow identifiers in the flow lookup data structure, thereby preserving the priority order of the flow rules for the port after the update.
 9. A method, comprising: identifying a generic flow definition which specifies a flow that is not specific to any input port of a switch; and storing in a flow lookup data structure one or more port-specific flow rules based on the generic flow definition, wherein each port-specific flow rule corresponds to a respective port capable of processing data flows.
 10. The method of claim 9, wherein the flow lookup data structure is stored in a CAM.
 11. The method of claim 9, further comprising storing in a flow table the generic flow definition with a flag indicating that the generic flow definition is not specific to any input port.
 12. The method of claim 9, wherein the switch is an OpenFlow-capable switch.
 13. The method of claim 9, further comprising maintaining a per-port linked list for a respective port capable of processing data flows; wherein a node in the linked list indicates a flow identifier for a flow definition applicable to the port; and wherein the nodes in the linked list are sorted in the order of priority of the corresponding flow definitions.
 14. The method of claim 13, further comprising storing in a flow table one or more flow definitions with corresponding flow identifier(s).
 15. The method of claim 14, wherein a respective entry in the flow table stores a flow definition; wherein the method further comprises computing a hash value based on the flow identifier for the flow definition; and wherein the hash value is used as an index to the entry.
 16. The method of claim 14, further comprising updating a flow definition by: traversing a per-port linked list for a port associated with the flow definition to be updated to locate a flow identifier for the flow definition to be updated; determining one or more flow identifiers whose priority is lower than the located flow identifier; and rewriting the flow rules associated with the determined flow identifiers in the flow lookup data structure, thereby preserving the priority order of the flow rules for the port after the update.
 17. A switch means, comprising: a flow definition management means for identifying a generic flow definition which specifies a flow that is not specific to any input port of the switch; and a flow lookup means for storing one or more port-specific flow rules based on the generic flow definition, wherein each port-specific flow rule corresponds to a respective port capable of processing data flows.
 18. The switch means of claim 17, further comprising: a per-port linked list means for storing flow identifiers for a respective port capable of processing data flows.
 19. The switch means of claim 17, further comprising a flow table means for storing the generic flow definition with a flag indicating that the generic flow definition is not specific to any input port.
 20. The switch means of claim 17, further comprising a flow definition updating means for updating a flow definition. 